var Cache = new Object();

Cache.types = {report: "REPORT_"};

Cache.set = function (type, key, data) {
    sessionStorage.setItem(type + key, $.toJSON(data));
};

Cache.get = function (type, key) {
    var data = sessionStorage.getItem(type + key);
    return data && $.evalJSON(data);
};

Cache.remove = function (type, key) {
    sessionStorage.removeItem(type + key);
};

Cache.clear = function (type) {
    var matchedKeys = new Array();

    for (var i = 0; i < sessionStorage.length; i++) {
        var key = sessionStorage.key(i);
        if (key.indexOf(type) == 0) {
            matchedKeys[i] = key;
        }
    }

    for (var key in matchedKeys) {
        sessionStorage.removeItem(matchedKeys[key]);
    }
}